package dataBase;

import java.sql.*;
import javax.swing.JOptionPane;

public class Db {

    public String bd = "fotocopiadora";
    public String login = "root";
//   public String password = "4ddcddcb1c1dd7d82b48f5fa8da8a3e9";
   public String password = "";
   // public String password = "metallica21";
    public String url = "jdbc:mysql://localhost/fotocopiadora";
    private Statement st;
    private Connection conn;
    
    
    
 public  Db() {
        conn = null;
        try {
            
            Class.forName("org.gjt.mm.mysql.Driver");
            conn = DriverManager.getConnection(url, login, password);
            
            if (conn != null) {
                System.out.println("Conexión a base de datos " + url + " ... Ok");
                st = conn.createStatement();
                
            }
        } catch (SQLException ex) {
            System.out.println("Hubo un problema al intentar conectarse con la base de datos " + url);
        } catch (ClassNotFoundException ex) {
            System.out.println(ex);
        }
    }
    
    public Connection getConection(){
        
        return conn;
        
    }
    
    public Statement getStatement(){
        
        
        return st;
        
    }
    
    
    
}